import request from '@/utils/request'

// 获取部门信息
export const getDepartments = () => {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

// 删除部门
export const deleteDepartments = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

// 新增部门
export const addDepartments = (data) => {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

// 根据id获取部门的详细信息
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'GET'
  })
}

// 编辑部门信息
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
